package demo2;

public abstract class Animal {
    public String name;

    public Animal(String name) {
        this.name = name;
    }

    public void eat() {
        System.out.println(this.name+"正在吃");
    }
}
class Dog extends Animal implements IRun,ISwim {


    public Dog(String name) {
        super(name);
    }

    @Override
    public void eat() {
        System.out.println(this.name+"正在吃狗粮");
    }

    @Override
    public void run() {
        System.out.println(this.name+"正在用四条腿跑……");
    }

    @Override
    public void swim() {
        System.out.println(this.name+"正在用四条腿游泳……");
    }
}
class Duck extends Animal implements IRun,ISwim,IFly {

    public Duck(String name) {
        super(name);
    }

    @Override
    public void eat() {
        System.out.println(this.name+"正在吃鸭粮");
    }

    @Override
    public void run() {
        System.out.println(this.name+"正在用两个脚跑……");
    }
    @Override
    public void swim() {
        System.out.println(this.name+"正在用两条腿游泳……");
    }
    @Override
    public void fly() {
        System.out.println(this.name+"正在用两个翅膀飞……");
    }
}



